from fastapi import APIRouter
from server.routers.system_router import system
from server.routers.auth_router import auth
from server.routers.chat_router import chat
from server.routers.knowledge_router import knowledge
from server.routers.graph_router import graph
from server.routers.tool_router import tool
from server.routers.api_key_router import api_key_router
from server.routers.situation_router import situation
from server.routers.relationship_router import relationship_router
from server.routers.situation_sync_router import sync_router

router = APIRouter()

# 注册路由结构
router.include_router(system)              # /api/system/*
router.include_router(auth)                # /api/auth/*
router.include_router(chat)                # /api/chat/*
router.include_router(knowledge)           # /api/knowledge/*
router.include_router(graph)               # /api/graph/*
router.include_router(tool)                # /api/tool/*
router.include_router(api_key_router)      # /api/api-key/*

# 将 sync_router 的路由直接添加到 situation 路由中，避免前缀冲突
# 通过遍历 sync_router.routes 并逐个添加到 situation 路由
for route in sync_router.routes:
    situation.routes.append(route)

router.include_router(situation)           # /api/situation/*
router.include_router(relationship_router) # /api/situation/relationships/*
